package com.mz.ieann.aide.media.svga

import android.os.Bundle
import android.widget.Toast
import com.mz.ieann.aide.R
import com.mz.ieann.aide.base.BaseActivity
import com.mz.ieann.aide.widget.reward.IRewardListener
import com.mz.ieann.aide.widget.reward.RewardEquallyView
import com.mz.ieann.aide.widget.reward.RewardRatioView

/**
 * <p>------------------------------------------------------
 * <p> If there is technical discussion, you can contact zhangmz90@foxmail.com
 * <p>------------------------------------------------------
 * <p>
 * <p>
 *
 * @author Created by zhangmz
 * @date on 2023/2/28
 */
class RewardActivity: BaseActivity() {

    private lateinit var rewardRatioView: RewardRatioView
    private lateinit var rewardEquallyView: RewardEquallyView

    /**
     * 扇形区域大小，值相加必须=1
     */
    private val probability = arrayOf(0.05f, 0.1f, 0.2f, 0.1f, 0.05f, 0.1f, 0.1f, 0.05f, 0.15f, 0.1f)

    /**
     * 扇形区域文字
     */
    private val describe = arrayOf("概率0.05", "概率0.1", "概率0.2", "概率0.1", "概率0.05", "概率0.1", "概率0.1", "概率0.05", "概率0.15", "概率0.1")


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_reward_layout)

        rewardRatioView = findViewById(R.id.rewardRatioView)
        rewardRatioView.addProbability(probability)
        rewardRatioView.addDescribe(describe)
        rewardRatioView.addRewardListener(object : IRewardListener {
            override fun prizewinning(index: Int) {
                Toast.makeText(this@RewardActivity, "恭喜你抽中了:${describe[index]}", Toast.LENGTH_SHORT).show()
            }
        })

        rewardEquallyView = findViewById(R.id.rewardEquallyView)
        rewardEquallyView.addDescribe(describe)

    }

}